The embedded system is the device or system that is designed to execute special function for special applications and controlled by the internal computer. In recent years, with the fast advancement of the computer science technology and the network communication technology, the development and application of the embedded system have been gaining rapid growth and great popularity. Flash memory storage media is a nonvolatile memory. The Flash memory has features that the internal information can be retained after the Flash memory is power-off and the flash memory can be erased and programmed repeatedly, and the like. Presently, embedded systems using the Flash memory as the storage media are applied widely.
The Flash memory has the following physical properties: when the Flash memory is in the clean situation (it is erased, but the write operation has not been committed), each bit of the Flash memory is 1; each bit of the Flash memory can be set to 0 via the write operation, but it is impossible to set 0 to 1 through the write operation, it must be processed through the erase operation. Generally, the erase operation must be executed with the unit of one Physical Block. The lifetime of the Flash memory is limited, and is determined by the maximum erasable/programmable times of the Physical Block. A Physical Block exceeding its maximum erasable/programmable times becomes a bad Block, and the bad Block can never be used again.
The degree of wear of a memory unit in the Flash memory system is changed according to the erase/program frequency of the memory unit such as the Physical Block. If a memory unit is infrequently erased and programmed, the degree of wear of the memory unit is low. However, if a memory unit is frequently erased and programmed, the degree of wear of the memory unit is high. Because of the inherent properties of the embedded system, the host may repeatedly execute the operation of writing data in the logical address area of a fixed range, and the memory units in the same area in the Flash memory may be repeatedly written and erased. When some memory units become bad units due to exceeding the maximum erasable/programmable times and other memory units are not worn, the general performance of the Flash memory system is decreased because of the present of the bad units. Generally, when there are a lot of bad units in the Flash memory system and the ratio of the bad units is equal to or exceeds the allowable limitation for normal use of the Flash memory system, even though many other memory units in the Flash memory system are not worn, the Flash memory system can not be used anymore. Therefore, in order to avoid some memory units being excessively erased and written, so that these memory units will not reach the maximum erasable/programmable times earlier than the other memory units, the erase and write operation should be distributed uniformly on each memory unit without affecting the system performance. The process is called wear leveling.
According to the conventional wear leveling method, the information of each memory unit, such as the erase/write times, is recorded in a special position in the memory. For example, with respect to the NAND Flash, the information is recorded in a specific spare area configured for each page. According to the erase/write times of each memory unit, the policy may be made between the memory units with more erase/write times and the memory units with less erase/write times. The policy generally relates to exchange physical units corresponding to different logical addresses and exchange data in these physical units, thus implementing the erase/write evenness among the physical units.